--- node.module	2008-06-07 10:52:54.000000000 +1000
+++ node.module	2008-07-10 15:55:07.468750000 +1000
@@ -2765,24 +2765,46 @@ function node_access($op, $node = NULL) 
 
   // If the module did not override the access rights, use those set in the
   // node_access table.
-  if ($op != 'create' && $node->nid && $node->status) {
-    $grants = array();
-    foreach (node_access_grants($op) as $realm => $gids) {
-      foreach ($gids as $gid) {
-        $grants[] = "(gid = $gid AND realm = '$realm')";
+  // Added if statement to allow access to unpublished content for logged in editors while disabling it for anonymous users 
+  if ($user->uid != 0) {
+    if ($op != 'create' && $node->nid) {
+      $grants = array();
+      foreach (node_access_grants($op) as $realm => $gids) {
+        foreach ($gids as $gid) {
+          $grants[] = "(gid = $gid AND realm = '$realm')";
+        }
       }
+  
+      $grants_sql = '';
+      if (count($grants)) {
+        $grants_sql = 'AND ('. implode(' OR ', $grants) .')';
+      }
+  
+      $sql = "SELECT COUNT(*) FROM {node_access} WHERE (nid = 0 OR nid = %d) $grants_sql AND grant_$op >= 1";
+      $result = db_query($sql, $node->nid);
+      return (db_result($result));
+    }
+  } else {
+    if ($op != 'create' && $node->nid && $node->status) {
+      $grants = array();
+      foreach (node_access_grants($op) as $realm => $gids) {
+        foreach ($gids as $gid) {
+          $grants[] = "(gid = $gid AND realm = '$realm')";
+        }
+      }
+  
+      $grants_sql = '';
+      if (count($grants)) {
+        $grants_sql = 'AND ('. implode(' OR ', $grants) .')';
+      }
+  
+      $sql = "SELECT COUNT(*) FROM {node_access} WHERE (nid = 0 OR nid = %d) $grants_sql AND grant_$op >= 1";
+      $result = db_query($sql, $node->nid);
+      return (db_result($result));
     }
-
-    $grants_sql = '';
-    if (count($grants)) {
-      $grants_sql = 'AND ('. implode(' OR ', $grants) .')';
-    }
-
-    $sql = "SELECT COUNT(*) FROM {node_access} WHERE (nid = 0 OR nid = %d) $grants_sql AND grant_$op >= 1";
-    $result = db_query($sql, $node->nid);
-    return (db_result($result));
   }
-
+  // Close if statement to allow access to unpublished content for logged in editors while disabling it for anonymous users
+   
   // Let authors view their own nodes.
   if ($op == 'view' && $user->uid == $node->uid && $user->uid != 0) {
     return TRUE;
